<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    // 求叠数之和(1-9)
    // 4+44+444+4444+44444
    var a = prompt("请输入你要叠多少次：")
    var b = prompt("请输入你要叠的数字（1~9）")
    var zongshu = 0;
    var shu = 0;
    if (b <= 9 && b >= 1) {
        for (var i = 0; i < a; i++) {
            shu = shu * 10 + b * 1
            zongshu = zongshu + shu
        }
    }
    document.write("叠数和为：" + zongshu);
</script>